package com.treasure.web.service;

import com.treasure.common.enums.LoginRouteEnum;
import com.treasure.common.enums.RegisterChannelEnum;
import com.treasure.common.model.PageResult;
import com.treasure.infrastructure.model.po.Account;
import com.baomidou.mybatisplus.extension.service.IService;
import com.treasure.infrastructure.model.po.CorpInfo;
import com.treasure.infrastructure.model.po.CorpUserInfo;
import com.treasure.web.command.PasswordEditRequest;
import com.treasure.web.command.base.PageBaseQuery;
import com.treasure.web.command.request.CorpEditRequest;
import com.treasure.web.command.request.CreateCorpAccountRequest;
import com.treasure.web.command.request.EditUserPasswordRequest;
import com.treasure.web.command.request.login.ExternalLoginRequest;
import com.treasure.web.command.request.login.LoginRequest;
import com.treasure.web.command.request.login.RegisterRequest;
import com.treasure.web.command.response.AccountUserInfoResponse;
import com.treasure.web.command.response.CorpUserInfoResponse;

import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author sunhongmin
 * @since 2023-08-31
 */
public interface IAccountService extends IService<Account> {

    /**
     * 账户注册
     *
     * @param request
     */
    void register(RegisterRequest request);

    /**
     * 企业用户登录
     *
     * @param loginRequest
     * @param loginRouteEnum
     */
    List<CorpUserInfo> login(LoginRequest loginRequest, LoginRouteEnum loginRouteEnum);

    /**
     * 跳转登录
     *
     * @param externalLoginRequest
     * @return
     */
    CorpUserInfo externalLogin(ExternalLoginRequest externalLoginRequest);

    /**
     * 创建企业账户
     *
     * @param createCorpAccountRequest
     * @return
     */
    CorpInfo createCorpAccount(CreateCorpAccountRequest createCorpAccountRequest, RegisterChannelEnum registerChannel) throws IOException, IllegalAccessException;

    /**
     * 企业编辑操作
     * @param corpEditRequest
     */
    void corpEdit(CorpEditRequest corpEditRequest);

    /**
     * 获取企业用户信息
     *
     * @return
     */
    AccountUserInfoResponse getAccountUserInfo();

    /**
     * 获取企业信息
     *
     * @param inviteCode
     * @return
     */
    CorpInfo getCorpInfoFromInviteCode(String inviteCode);

    /**
     * 修改密码
     *
     * @param passwordEditRequest
     */
    void editPassword(PasswordEditRequest passwordEditRequest);

    /**
     * 企业用户列表
     *
     * @return
     */
    PageResult<CorpUserInfoResponse> userList(PageBaseQuery pageBaseQuery);

    /**
     * 编辑用户密码
     * @param editUserPasswordRequest
     */
    void editUserPassword(EditUserPasswordRequest editUserPasswordRequest);
}
